<template>
	<van-popup :show.sync="value" round @close="close">
		<view class="alert">
			<view class="alert-title">{{title}}</view>
			<textarea placeholder="请输入备注信息" placeholder-class="placeholder-class" v-model="note"></textarea>
			<view class="alert-footer flex-space-between">
				<view class="btn-item flex-center" @click="close">取消</view>
				<view class="btn-item flex-center" @click="confirm">确定</view>
			</view>
		</view>
	</van-popup>

</template>

<script>
	export default {
		name: "config-alert",
		props:{
			title:{
				type:String,
				required:true
			},
			value:{
				type:Boolean,
				default:false
			}
		},
	
		data() {
			return {
				note:''
			};
		},
		methods:{
			close(){
				this.$emit("input",false)
			},
			confirm(){
				this.$emit("confirm",this.note)
				this.note = ''
			}
		}
	}
</script>

<style lang="scss" scoped>
	.alert {
		padding: 40rpx 49rpx 40rpx 50rpx;
		background-color: #ffffff;
		border-radius: 20rpx;
		width: 80vw;
		/deep/ .placeholder-class{
		  font-size: 24rpx;
		   color: #bebebe;
		}

		.alert-title {
			color: #000;
			font-size: 32rpx;
			font-family: PingFang SC;
			font-weight: 500;
			text-align: center;
		}

		textarea {
			width: 100%;
			margin-top: 40rpx;
			background-color: #f3f3f3;
			border-radius: 10rpx;
			box-sizing: border-box;
			padding: 30rpx;
			font-size: 24rpx;
		}

		.alert-footer {
			position: relative;
			padding: 0;
			bottom: auto;
			margin-top: 26rpx;

			.btn-item {
				width: 49%;
				background-color: #cccccc;
				height: 80rpx;
				border-radius: 40rpx;
				color: #ffffff;
				font-size: 30rpx;
				font-family: PingFang SC;
				font-weight: 700;

				&:last-of-type {
					background-image: linear-gradient(0deg, #635df7 0%, #a5adf6 100%);
				}
			}
		}
	}
</style>
